<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:ez="http://java.sun.com/jsf/composite/ezcomp"
                xmlns:pe="http://primefaces.org/ui/extensions">

    <ui:define name="content">

        <h:panelGroup rendered="true" >
            
            <h:form>
                <p:panel id="reportPrint" styleClass="noBorder summeryBorder" header="Casheir Session Report Detail">

                    <f:facet name="header" >
                        
                        <h:outputLabel value="#{commonReport.webUser.institution.name}"/> <br/>
                        <h:outputLabel value="Cashier Detailed Report - Lab Bills -&nbsp;&nbsp; #{commonReport.webUser.webUserPerson.name}"/>
                        <p:commandButton ajax="false" value="Refresh" styleClass="noPrintButton" style="float: right;" actionListener="#{commonReport.recreteModal()}" />  
                        <p:commandButton ajax="false" value="Print" styleClass="noPrintButton" style="float: right;" >
                            <p:printer target="reportPrint" />
                        </p:commandButton> 
                        
                        <p:commandButton 
                      ajax="false" 
                        value="Excel"  
                        styleClass="noPrintButton" 
                        style="float: right;" >
                        <pe:exporter 
                            type="xlsx" 
                            target="tbl" 
                            fileName="Cashier Detailed Report"
                            subTable="true"/>  
                    </p:commandButton>
                        
                                               
                    </f:facet>


                    <p:panelGrid columns="6" styleClass="noPrintButton" >
                        <h:outputLabel value="From Date"/>
                        <p:calendar id="frmDate" value="#{commonReport.fromDate}" navigator="true"  pattern="dd MMMM yyyy HH:mm:ss" >
                        </p:calendar>

                        <h:outputLabel value="To Date"/>
                        <p:calendar id="toDate" value="#{commonReport.toDate}" navigator="true" pattern="dd MMMM yyyy HH:mm:ss" >
                        </p:calendar>
                        <h:outputLabel styleClass="noPrintButton" value="User Name"/>
                        <p:autoComplete forceSelection="true" converter="webUs" completeMethod="#{webUserController.completeUser}" styleClass="noPrintButton"
                                        var="w" itemLabel="#{w.webUserPerson.name}" itemValue="#{w}"
                                        value="#{commonReport.webUser}" ></p:autoComplete>
                    </p:panelGrid>

                    <p:panelGrid columns="4" styleClass="printBlock">
                        <h:outputLabel value="From" />
                        <h:outputLabel  value="#{commonReport.fromDate}" >
                            <f:convertDateTime pattern="dd MM yy hh:mm a"/>
                        </h:outputLabel>
                        <h:outputLabel value="To"/>
                        <h:outputLabel  value="#{commonReport.toDate}" style="float: right" >
                            <f:convertDateTime pattern="dd MM yy hh:mm a"/>
                        </h:outputLabel>
                    </p:panelGrid>


                    <ez:tableBilledBill   bill="#{commonReport.userBills}"/>

                    <ez:tableCancelledBill bill="#{commonReport.userCancelledBills}"/>

                    <ez:tableRefundBill bill="#{commonReport.userRefundedBills}"/>

                    <ez:tablePaymentBill bill="#{commonReport.userPaymentBills}"/>

                    <ez:tablePaymentCancel bill="#{commonReport.userPaymentCancelBills}"/>

                    <ez:tablePettyPayment bill="#{commonReport.pettyPayments}"/>

                    <ez:tablePettyCancel bill="#{commonReport.pettyPaymentsCancel}" />

                    <ez:tableCompanyPayment bill="#{commonReport.cashRecieves}" />

                    <ez:tableCompanyCancel bill="#{commonReport.cashRecieveCancel}"/>

                    <ez:tableAgentPayment bill="#{commonReport.agentRecieves}" />

                    <ez:tableAgentCancel bill="#{commonReport.agentCancelBill}" />


                    <br></br><br></br><br></br>
                    <h:outputLabel value="Final Credit Total : "/>
                    <h:outputLabel style="font-weight: bold;text-align: right;" value="#{commonReport.finalCreditTotal}"><f:convertNumber pattern="#,##0.00" /></h:outputLabel>
                    <br/>
                    <h:outputLabel value="Final Credit Card Total : "/>
                    <h:outputLabel style="font-weight: bold;text-align: right;" value="#{commonReport.finalCreditCardTotal}"><f:convertNumber pattern="#,##0.00" /></h:outputLabel><br/>
                    <br/>
                    <h:outputLabel value="Final Cheque Total : "/>
                    <h:outputLabel value="#{commonReport.finalChequeTot}" style="font-weight: bold;text-align: right;"   ><f:convertNumber pattern="#,##0.00" /></h:outputLabel>
                    <br/>
                    <h:outputLabel value="Final Slip Total : "/>
                    <h:outputLabel  value="#{commonReport.finalSlipTot}" style="font-weight: bold;text-align: right;"  ><f:convertNumber pattern="#,##0.00" /></h:outputLabel>
                    <br/>
                    <h:outputLabel value="Final Cash Total : "/>
                    <h:outputLabel style="font-weight: bold;text-align: right;" value="#{commonReport.finalCashTotal}"><f:convertNumber pattern="#,##0.00" /></h:outputLabel>

                </p:panel>
            </h:form>
        </h:panelGroup>
    </ui:define>

</ui:composition>
